<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>帮帮网</title>
<link href="default.css" media="screen" rel="stylesheet" />
<!-- 引入 jQuery --> 
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>  -->
<script src="JS/jquery-1.3.2.min.js" type="text/javascript"></script>
<!--<script type="text/javascript" src="JS/prototype.js"></script>-->
<script type="text/javascript" src="JS/httpRequest.js"></script>
<script type="text/javascript" src="JS/cookie.js"></script>
<script type="text/javascript">  
//等待dom元素加载完毕.  
$(document).ready(function(){ 
	
	$("#selector ul li").click(function(){
		if($(this).hasClass("selector_on"))
		{
			
		}
		else
		{
			var sel_on = $("#selector .selector_on");
			sel_on.addClass("selector_off");
			sel_on.removeClass("selector_on");
			$(this).addClass("selector_on");
			$(this).removeClass("selector_off");
			//todo 刷新任务推送内容
		}
	});

	$("#sidebar ul li").hover(
		function(){
			$(this).addClass("selector_on");
			$(this).removeClass("selector_off");
			//todo 抽出关注度最高的十个人 悬浮于右侧
		},
		function(){
			$(this).addClass("selector_off");
			$(this).removeClass("selector_on");
			//todo 取消显示右侧的人名
		}
	);

});  
function GetUserInfo()
{
	//body onload调用的函数 所以计算几个全局变量
	username=getCookie('username');
	userID = getCookie('userID');
	timenow = new Date();

	var contentURL = document.location.search;
	hisid = contentURL.slice(1);	//helpid

	if(userID==hisid)//页面重定向 改为相对路径
		//window.location.href="http://localhost/HelpSite/myspace.htm";
		window.location.href="myspace.htm";
	//根据cookie提供的用户名 username 去取得用户的信息
	var url="user/user.php?action=GetUserInfobyID";
	var para="userID="+hisid;
	var resp=SendPostRequest(url,para);
	//alert(resp);

	if(resp!=null)
	{
		var UserInfoListDiv=document.getElementById('user_info');
		//刷新前 先清空子节点
		var childs = UserInfoListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			UserInfoListDiv.removeChild(childs[i]);
		}

		var userinfo=eval("("+resp+")");
		for(var i=0;i<userinfo.length;i++)
		{
			var userinfoDiv=document.createElement('div');
			userinfoDiv.style.width="300px";
			userinfoDiv.style.margin="20px";
			userinfoDiv.style.border="1px solid #ccc";
			
			//姓名
			var nameDiv=document.createElement('div');
			nameDiv.style.padding="10px";
			nameDiv.innerHTML="<font style='font:14px bold'>"+userinfo[i].name+"</font>";
			hisname = userinfo[i].name;
	
			//头像 todo
			var avatarDiv=document.createElement('div');
			avatarDiv.style.padding="10px";
			//avatarDiv.innerHTML="<font style='font:14px bold'>头像 <a href='imgpick/imgpick.htm' > 上传头像 </a></font>";	
			//avatarDiv.innerHTML="<img id='av' src='imgpick/uploads/"+userID+".png'> onerror=' av.src='imgpick/uploads/0.jpg' ' ";	
			//去掉后缀名 兼容各种图片
			avatarDiv.innerHTML="<div id='av'><img src='imgpick/uploads/"+hisid+"?"+timenow+"' onerror='nopic()' alt='修改头像' /></div>";	

			//相册
			var albumDiv=document.createElement('div');
			albumDiv.style.padding="10px";
			albumDiv.innerHTML="<font style='font:14px bold'>相册 交由周青移植整合   "+userinfo[i]. album+"</font>";	

			//id
			var idDiv=document.createElement('div');
			idDiv.style.padding="10px";
			idDiv.innerHTML="<font style='font:14px bold'>"+userinfo[i].id+"</font>";	

			//qq
			var qqDiv=document.createElement('div');
			qqDiv.style.padding="10px";
			qqDiv.innerHTML="<font style='font:14px bold'>QQ：   "+userinfo[i].qq+"</font>";	

			//cellphone
			var cellDiv=document.createElement('div');
			cellDiv.style.padding="10px";
			cellDiv.innerHTML="<font style='font:14px bold'>手机号码：   "+userinfo[i].cellphone+"</font>";

			//sex
			var sexDiv=document.createElement('div');
			sexDiv.style.padding="10px";
			sexDiv.innerHTML="<font style='font:14px bold'>性别：   "+userinfo[i].sex+"</font>";
			
			//emot
			var emotDiv=document.createElement('div');
			emotDiv.style.padding="10px";
			emotDiv.innerHTML="<font style='font:14px bold'>感情状态：   "+userinfo[i].emot+"</font>";

			//出生年月日
			var birthDiv=document.createElement('div');
			birthDiv.style.padding="10px";
			birthDiv.innerHTML="<font style='font:14px bold'>出生年月日：   "+userinfo[i].year+"年"+userinfo[i].month
			+"月"+userinfo[i].day+"日"+"</font>";		

			//经验值 活跃度
			var expDiv=document.createElement('div');
			expDiv.style.padding="10px";
			expDiv.innerHTML="<font style='font:14px bold'>活跃度     "+userinfo[i].exp+"</font>";	
			
			//好评度
			var goodCommentDiv=document.createElement('div');
			goodCommentDiv.style.padding="10px";
			goodCommentDiv.innerHTML="<font style='font:14px bold'>好评度      "+userinfo[i].goodcomment+"</font>";	

			//差评度
			var badCommentDiv=document.createElement('div');
			badCommentDiv.style.padding="10px";
			badCommentDiv.innerHTML="<font style='font:14px bold'>差评度       "+userinfo[i].badcomment+"</font>";	

			//历史记录
			var historyDiv=document.createElement('div');
			historyDiv.style.padding="10px";
			historyDiv.innerHTML="<font style='font:14px bold'>历史记录 等待系统完成后再完善   "+userinfo[i].history+"</font>";	

			userinfoDiv.appendChild(nameDiv);
			userinfoDiv.appendChild(avatarDiv);
			userinfoDiv.appendChild(albumDiv);
			userinfoDiv.appendChild(qqDiv);
			userinfoDiv.appendChild(cellDiv);
			userinfoDiv.appendChild(sexDiv);
			userinfoDiv.appendChild(emotDiv);
			userinfoDiv.appendChild(birthDiv);
			userinfoDiv.appendChild(expDiv);
			userinfoDiv.appendChild(goodCommentDiv);
			userinfoDiv.appendChild(badCommentDiv);
			userinfoDiv.appendChild(historyDiv);			

			UserInfoListDiv.appendChild(userinfoDiv);
		}
	}
	else
	{
		alert('resp is NULL');
	}

	//showFriends();
	//showFollowers();

}

function follow()
{
	//hisid	hisname userID username startTime point
	//alert('follow');
	//alert(hisname);
	if(hisid==userID)
	{
		alert('你不能加自己为好友 人应该少关注自己哦');
		return;
	}
	var url="friend/friend.php?action=follow";
	var para="friendid="+hisid;
	para+="&friendname="+hisname;
	para+="&followid="+userID;
	para+="&followname="+username;
	var resp=SendPostRequest(url,para);
	//alert(resp);	
	if (resp=="你已经关注他鸟")
	{
		alert('你已经关注他了');
	}
	if(resp=="true")
		alert('关注成功');
	if(resp=="false")
		alert('关注失败');	

}

</script>  
</head>
<body onload="GetUserInfo()">
  <div id="all">
    <div id="header">
        <div id="inner_header" class="central_fixed_width">
			<img src='imgpick/uploads/logo.jpg'/> 
		    <h1 class="logo">帮帮网</h1>
            <div id="user_status"><a href="login.htm">登陆</a>||<a href="register.html">注册</a></div>
            <ul id="nav_bar">
                <li><a href="activity/activity.html"><span class="nav_item">活动</span></a></li>
                <li><a href="index.html"><span class="nav_item">悬赏求助大厅</span></a></li>
                <li><a href="myspace.html"><span class="nav_item">个人主页</span></a></li>
                <li><a href="dianping.html"><span class="nav_item">点评</span></a></li>
                <li><a href="novel.html"><span class="nav_item">小说</span></a></li>
                <li class="clear"></li>
            </ul>
        </div>
    </div>
    
    <div id="content" class="central_fixed_width">

        <div class="content_parent">
			<div id="left_bar">
				<input type="button" onclick="follow()" value="关注ta" />
                <div id="user_info">
                    <div id="user_avatar">
                        <img src="1" />
                    </div>
                    <div id="user_data">
						<p>郑国栋</p>
                        <p>QQ：250082363</p>
                        <p>手机：15026597525</p>
                        <p>性别：男</p>
                        <p>状态：恋爱中</p>
						<p>出生年月日： 0年0月0日</p>
						<p>活跃度 8</p>
						<p>好评度 890</p>
						<p>差评度 0</p>
						<p>历史记录</p>
                    </div>
                </div>

			</div>

            <div class="main_column">
                <div id="selector">
                    <ul>
                        <li class="selector_on">ta关注的</li>
                        <li class="selector_off" onclick="showiApplyList()">ta申请的</li>
                        <li class="selector_off" onclick="showiChooseList()">指定给ta的</li>
                        <li id="ireqli" class="selector_off" onclick="showiReqList()">ta发布的</li>
                        <li class="selector_off" onclick="showAllReqList()">随便看看</li>
                        <li id="reqli" class="selector_off" onclick="addHelp()">发布任务</li>
                    </ul>
                    <div class="clear"></div>
                </div>
                <div id="helps">
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
					
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                </div>

				<div id="addhelp">
					<h3>悬赏</h3>
					<div>
						标题:<input id="title"  onblur="CheckEmpty(this,'warntitle','标题有效期不能为空！')"/><span id="warntitle" class="warning">&nbsp;*</span><br>
						目标赏金:<input id="money" type="text" size="24" />RMB<br>
						类别:<select id="cate">
							<option value=''></option>
							<option value=1 >生活</option>
							<option value=2 >软件</option>
							<option value=3 >电脑</option>
							<option value=4 >足球</option>
							</select><br>
							简介:<br><textarea id="description"  rows="3" cols="50"  onblur="CheckEmpty(this,'warndes','简介不能为空！')"  ></textarea>
							<span id="warndes" class="warning">&nbsp;*</span><br>
							具体内容:<br><textarea id="detail"  rows="15" cols="50" onblur="CheckEmpty(this,'warnDetail','具体内容不能为空！')"  ></textarea>
							<span id="warnDetail" class="warning">&nbsp;*</span><br>
							上传附件:<input type="file" id="upfile"/><br>
							<br>
							<input type="button" value="确定" onclick="reqHelp()"/>    
					</div>
				</div>

            </div>

            <div class="sidebar">
                    <ul>
                        <a href="具体功能未实现friend/friend.htm?userID" ><li class="selector_off">ta关注的人</li></a>
                        <a href="具体功能未实现friend/follower.htm?userID" ><li class="selector_off">关注ta的人</li></a>
                    </ul>
            </div>
            <div class="clear"></div>
        </div>
        
        
    </div>
    
    <div id="footer">
        <div id="inner_footer" class="central_fixed_width">


            <div class="footer_links">
                &copy; 2011 帮帮网 All rights reserved.
            </div>
            <div class="clear"></div>
            
        </div>
    </div>
  </div>
</body>
</html>

